﻿<?xml version="1.0" encoding="utf-8" ?>
<log4net>
  <!-- Allows writing to a log file -->
  <appender name="FileAppender" type="log4net.Appender.RollingFileAppender">
    <file value="${APPDATA}\Probel\nDoctor Light\Logs\ldoc.log"/>
    <appendToFile value="true"/>
    <maximumFileSize value="3000KB"/>
    <maxSizeRollBackups value="20"/>

    <layout type="log4net.Layout.PatternLayout">
      <conversionPattern value="%date | %-5level | %message%newline"/>
    </layout>

    <!-- Hide the benchmark logger in this file -->
    <filter type="log4net.Filter.LoggerMatchFilter">
      <loggerToMatch value="Probel.NDoctor.Domain.Components.Interceptors.BenchmarkInterceptor" />
      <acceptOnMatch value="false"/>
    </filter>
  </appender>

  <!-- NHibernate SQL: Will log only the SQL used with nHibernate -->
  <appender name="SqlAppender" type="log4net.Appender.FileAppender">
    <file value="${APPDATA}\Probel\nDoctor\Logs\Sql.log"/>
    <appendToFile value="false"/>

    <layout type="log4net.Layout.PatternLayout">
      <conversionPattern value="%date | %-5level | %message%newline"/>
    </layout>
  </appender>

  <!-- Writes to the console. The console is only visible in debug builds of nDoctor. -->
  <appender name="ColoredConsoleAppender" type="log4net.Appender.ColoredConsoleAppender">
    <mapping>
      <level value="FATAL" />
      <foreColor value="Red, HighIntensity"/>
      <backColor value="Yellow, HighIntensity"/>
    </mapping>
    <mapping>
      <level value="ERROR" />
      <foreColor value="Red, HighIntensity" />
    </mapping>
    <mapping>
      <level value="WARN" />
      <foreColor value="Yellow, HighIntensity" />
    </mapping>
    <mapping>
      <level value="INFO" />
      <foreColor value="White, HighIntensity" />
    </mapping>
    <mapping>
      <level value="DEBUG" />
      <foreColor value="Green, HighIntensity" />
    </mapping>

    <layout type="log4net.Layout.PatternLayout">
      <conversionPattern value="%date | %-5level | %message%newline" />
    </layout>

    <!-- Hide the benchmark logger in this file -->
    <filter type="log4net.Filter.LoggerMatchFilter">
      <loggerToMatch value="Probel.NDoctor.Domain.Components.Interceptors.BenchmarkInterceptor" />
      <acceptOnMatch value="false"/>
    </filter>
  </appender>

  <!-- Writes to OutputDebugString - use a tool like Sysinternals DebugView to view the log  -->
  <appender name="DebugAppender" type="log4net.Appender.OutputDebugStringAppender">
    <layout type="log4net.Layout.PatternLayout">
      <conversionPattern value="nDoctor - [%3thread] | %-5level | %message%newline" />
    </layout>
  </appender>

  <root>
    <level value="DEBUG"/>
    <appender-ref ref="FileAppender"/>
    <appender-ref ref="ColoredConsoleAppender"/>
    <appender-ref ref="DebugAppender"/>
  </root>

  <Logger name="NetStat">
    <level value="DEBUG"/>
  </Logger>
  <logger name="NHibernate">
    <level value="WARN"/>
  </logger>

  <logger name="NHibernate.SQL">
    <level value="WARN"/>
    <!--<appender-ref ref="SqlAppender"/>-->
  </logger>
</log4net>